package com.tsd.jxc.setting;

import com.tsd.core.datasource.DataSourceContextHolder;
import com.tsd.core.datasource.SpringContextUtil;
import com.tsd.jxc.setting.service.JxcSettingService;
import com.tsd.jxc.vo.JxcSettingVo;

/**
 * @ClassName: JxcSettingUtil
 * @Description: TODO
 * @Author: Hillpool
 * @Date: 2023/3/17 14:55
 * @Version: 1.0
 */
public class JxcSettingUtil {

    public static JxcSettingVo getSettingVo() {
        JxcSettingVo settingVo;
        try {
            JxcSettingService jxcSettingService = SpringContextUtil.getBean(JxcSettingService.class);
            settingVo = jxcSettingService.getJxcSettingVo(DataSourceContextHolder.getDataSourceType());
        } catch (Exception e) {
            settingVo = new JxcSettingVo();
            settingVo.setCode(JxcSettingVo.JXC_SETTING_CODE);
        }
        return settingVo;
    }

    public static boolean isClothing() {
        return getSettingVo().isClothing();
    }
}
